<?php
class applicationsController extends Controller
{
    /**报名管理
     * @return void
     */
    function showIndex()
    {
        $pagination_sql = "select a.*,u.userName as userName from applications a,user u where a.userId=u.userId";
        $pagination_count_sql = "select count(1) as count from applications a,user u where a.userId=u.userId ";
        $this->putIntoPage("pagination", $this->modules->Application->pagination($pagination_sql, $pagination_count_sql));
        $this->render("ApplicationsList");
    }

    function wait()
    {
        $pagination_sql = "select a.*,u.userName as userName from applications a,user u where a.userId=u.userId and a.status ='WAIT' ";
        $pagination_count_sql = "select count(1) as count from applications a,user u where a.userId=u.userId and a.status ='WAIT'  ";
        $this->putIntoPage("pagination", $this->modules->Application->pagination($pagination_sql, $pagination_count_sql));
        $this->render("ApplicationsList");
    }

    function pass()
    {
        $pagination_sql = "select a.*,u.userName as userName from applications a,user u where a.userId=u.userId and a.status ='PASS' ";
        $pagination_count_sql = "select count(1) as count from applications a,user u where a.userId=u.userId and a.status ='PASS'  ";
        $this->putIntoPage("pagination", $this->modules->Application->pagination($pagination_sql, $pagination_count_sql));
        $this->render("ApplicationsList");
    }

    function failure()
    {
        $pagination_sql = "select a.*,u.userName as userName from applications a,user u where a.userId=u.userId and a.status ='FAILURE' ";
        $pagination_count_sql = "select count(1) as count from applications a,user u where a.userId=u.userId and a.status ='FAILURE'  ";
        $this->putIntoPage("pagination", $this->modules->Application->pagination($pagination_sql, $pagination_count_sql));
        $this->render("ApplicationsList");
    }

    function doSomething()
    {
        $this->modules->Application->updateStatus($this->_get['id'], $this->_get['status']);
        $this->showIndex();
    }

    function show()
    {
        $this->putIntoPage("application", $this->modules->Application->load($this->_get['id']));
        $this->render("Applications");
    }
}

?>